<?php
namespace app\oa\controller;
use \app\oa\controller\Role as RoleController;
use app\oa\ext\Role;
use app\oa\model\Task;

class Boss extends RoleController {

    protected function getRole()
    {
        return [Role::Boss];
    }

    public function index() {
        $tasks = Task::all(['status'=>5]);
        $this->assign("tasks", $tasks);
        return $this->fetch("boss/index");
    }
    public function verify($id, $pass = 1) {
        $task = Task::get($id);
        if($pass) {
            $task['status'] = 6;
        }else {
            $task['status'] = 11;
        }

        if($task->save()) {
            $this->success("操作成功");
        }else {
            $this->error("操作失败");
        }
    }
}